package com.qf.test.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.test.pojo.DtsCategory;
import com.qf.test.vo.CatVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 类目表 Mapper 接口
 * </p>
 *
 * @author zhaojian
 * @since 2021-05-12
 */

public interface DtsCategoryMapper extends BaseMapper<DtsCategory> {
    /**
     * 商品类目   目录
     */
    @Select("select id 'value',`name` label from  dts_category WHERE deleted=0")
    public List<CatVo> findall();
    /**
     * 查询一级目录
     * @return
     */
    @Select("SELECT id as value,name as label from dts_category where deleted=0 and `level` ='L1'")
    public List<CatVo> select1();

    /**
     * 查询二级目录
     */
    @Select("SELECT id as value,name as label,pid from dts_category where deleted=0 and `level` ='L2'")
    public List<CatVo> select2();

}
